home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / svgakt50.zip / SRC / SVGAKIT / GETOPT.H < prev    next >
C/C++ Source or Header  |  1993-10-21  |  2KB  |  82 lines

  1. /****************************************************************************
  2. *
  3. *                   Copyright (C) 1993 SciTech Software.
  4. *                            All rights reserved.
  5. *
  6. * Filename:        $RCSfile: getopt.h $
  7. * Version:        $Revision: 1.6 $
  8. *
  9. * Language:        ANSI C
  10. * Environment:    any
  11. *
  12. * Description:    Header file for command line parsing module. This module
  13. *                contains code to parse the command line, extracting options
  14. *                and parameters in standard System V style.
  15. *
  16. * $Id: getopt.h 1.6 1991/12/31 19:41:06 kjb Exp $
  17. *
  18. ****************************************************************************/
  19.  
  20. #ifndef    __GETOPT_H
  21. #define    __GETOPT_H
  22.  
  23. #ifndef __DEBUG_H
  24. #include "debug.h"
  25. #endif
  26.  
  27. /*---------------------------- Typedef's etc -----------------------------*/
  28.  
  29. #define    ALLDONE        -1
  30. #define    PARAMETER    -2
  31. #define    INVALID        -3
  32. #define    HELP        -4
  33.  
  34. #define    MAXARG        80
  35.  
  36. /* Option type sepecifiers */
  37.  
  38. #define    OPT_INTEGER        'd'
  39. #define    OPT_HEX            'h'
  40. #define    OPT_OCTAL        'o'
  41. #define    OPT_UNSIGNED    'u'
  42. #define    OPT_LINTEGER    'D'
  43. #define    OPT_LHEX        'H'
  44. #define    OPT_LOCTAL        'O'
  45. #define    OPT_LUNSIGNED    'U'
  46. #define    OPT_FLOAT        'f'
  47. #define    OPT_DOUBLE        'F'
  48. #define    OPT_LDOUBLE        'L'
  49. #define    OPT_STRING        's'
  50. #define    OPT_SWITCH        '!'
  51.  
  52. typedef struct {
  53.     uchar    opt;                /* The letter to describe the option    */
  54.     uchar    type;                /* Type descriptor for the option        */
  55.     void    *arg;                /* Place to store the argument            */
  56.     char    *desc;                /* Description for this option            */
  57.     } Option;
  58.  
  59. #define    NUM_OPT(a)    sizeof(a) / sizeof(Option)
  60.  
  61. /*--------------------------- Global variables ---------------------------*/
  62.  
  63. extern    int        nextargv;
  64. extern    char    *nextchar;
  65.  
  66. /*------------------------- Function Prototypes --------------------------*/
  67.  
  68. #ifdef __cplusplus
  69. extern "C" {
  70. #endif
  71.  
  72. int getopt(int argc,char **argv,char *format,char **argument);
  73. int getargs(int argc,char *argv[],int num_opt,Option optarr[],
  74.             int (*do_param)(char *param,int num));
  75. void print_desc(int num_opt,Option optarr[]);
  76.  
  77. #ifdef __cplusplus
  78. }
  79. #endif
  80.  
  81. #endif
  82.